//
//  JourneyHeaderView.m
//  Travel_M_Travel
//
//  Created by APPLE10 on 15-3-23.
//  Copyright (c) 2015年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "JourneyHeaderView.h"
#import "UIColor+AddColor.h"
@implementation JourneyHeaderView

-(void)dealloc
{
    Block_release(_block);
    [_headerLable release];
    [super dealloc];
}

-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        
        UIImageView *imageV = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"ticket_pay_button@2x.png"]];
        imageV.frame = CGRectMake(5, 10, 10, self.frame.size.height - 20);
        [self addSubview:imageV];
        
        self.headerLable = [[UILabel alloc]initWithFrame:CGRectMake(20, 0,self.frame.size.width - 200 , self.frame.size.height)];
        _headerLable.font = [UIFont fontWithName:@"MarkerFelt-Wide" size:17];
        _headerLable.textColor= [UIColor colorFromHexCode:@"#4F4F4F"];
        [self addSubview:_headerLable];
        
        
        self.headerBtu= [UIButton buttonWithType:UIButtonTypeSystem];
        [_headerBtu addTarget:self action:@selector(headerBtuAction:) forControlEvents:UIControlEventTouchUpInside];
      _headerBtu.frame = CGRectMake(270, 15, 50, self.frame.size.height - 20);
        [_headerBtu setBackgroundImage:[UIImage imageNamed:@"goToNext1.png"] forState:UIControlStateNormal];
        _headerBtu.hidden = YES;
       [self addSubview:_headerBtu];
        
        
        [imageV release];
        [_headerLable release];
    }
    return self;
}

- (void)headerBtuAction :(UIButton *)btu
{
    self.block ();
    
}

- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes
{
    
    //如果是3.5.6.7将Button加到视图上边
    if (self.index == 4 || self.index == 6 || self.index == 7 || self.index == 8)
    {
//        NSLog(@"1111111");
        _headerBtu.hidden = NO;
        
    }
    
}


@end
